package com.lifeverse.event;

import com.lifeverse.entity.GroupDecision;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.HashMap;

/**
 * 群体决策事件
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class GroupDecisionEvent extends LifeEntityEvent {
    
    /**
     * 群体ID
     */
    private Long groupId;
    
    /**
     * 决策ID
     */
    private Long decisionId;
    
    /**
     * 决策类型
     */
    private GroupDecision.DecisionType decisionType;
    
    /**
     * 决策状态
     */
    private GroupDecision.DecisionStatus decisionStatus;
    
    /**
     * 决策事件类型
     */
    private DecisionEventType eventSubType;
    
    /**
     * 提议者ID
     */
    private Long proposerId;
    
    /**
     * 决策标题
     */
    private String decisionTitle;
    
    public GroupDecisionEvent() {
        super();
        setEventType("GROUP_DECISION");
        setEventData(new HashMap<>());
    }
    
    public GroupDecisionEvent(Long groupId, Long decisionId, DecisionEventType eventSubType) {
        this();
        this.groupId = groupId;
        this.decisionId = decisionId;
        this.eventSubType = eventSubType;
        setSourceEntityId(groupId);
    }
    
    /**
     * 决策事件子类型枚举
     */
    public enum DecisionEventType {
        PROPOSED("决策提议"),
        VOTING_STARTED("开始投票"),
        VOTE_CAST("投票"),
        VOTING_ENDED("投票结束"),
        APPROVED("决策通过"),
        REJECTED("决策拒绝"),
        IMPLEMENTED("决策实施"),
        CANCELLED("决策取消");
        
        private final String displayName;
        
        DecisionEventType(String displayName) {
            this.displayName = displayName;
        }
        
        public String getDisplayName() {
            return displayName;
        }
    }
}